home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 25
/
Aminet 25 (1998)(GTI - Schatztruhe)[!][Jun 1998].iso
/
Aminet
/
dev
/
debug
/
Wipeout.lha
/
source
/
segtracker.c
< prev
next >
Wrap
C/C++ Source or Header
|
1998-04-12
|
1KB
|
64 lines
/*
* $Id: segtracker.c 1.4 1998/04/12 17:29:58 olsen Exp olsen $
*
* :ts=4
*
* Wipeout -- Traces and munges memory and detects memory trashing
*
* Written by Olaf `Olsen' Barthel <olsen@sourcery.han.de>
* Public Domain
*/
#ifndef _GLOBAL_H
#include "global.h"
#endif /* _GLOBAL_H */
/******************************************************************************/
typedef char (* ASM SegTrack(REG(a0) ULONG Address,
REG(a1) ULONG * SegNum,
REG(a2) ULONG * Offset));
struct SegSem
{
struct SignalSemaphore seg_Semaphore;
SegTrack * seg_Find;
};
/******************************************************************************/
BOOL
FindAddress(
ULONG address,
LONG nameLen,
STRPTR nameBuffer,
ULONG * segmentPtr,
ULONG * offsetPtr)
{
struct SegSem * SegTracker;
BOOL found = FALSE;
Forbid();
/* check whether SegTracker was loaded */
SegTracker = (struct SegSem *)FindSemaphore("SegTracker");
if(SegTracker != NULL)
{
STRPTR name;
/* map the address to a name and a hunk/offset index */
name = (*SegTracker->seg_Find)(address,segmentPtr,offsetPtr);
if(name != NULL)
{
strncpy(nameBuffer,name,nameLen-1);
nameBuffer[nameLen-1] = '\0';
found = TRUE;
}
}
Permit();
return(found);
}